package com.crm.model.vo.contractReviewManager;

import com.crm.model.entity.orderManager.CustomerProductOrderDetail;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 合同审核详情VO
 * @author luojie
 * @date 2021/3/30 13:42
 */
@Data
public class ContractReviewDetailVO {

    //合同id
    private String contractId;

    //合同编号
    private String contractNumber;

    //合同类型
    private String contractType;

    //合同类型前端显示值(客户列表-合同&&订单-》合同详情)
    private String contractTypeText;

    //合同状态
    private String contractStatus;

    //合同状态(显示值)
    private String contractStatusText;

    //客户名称
    private String customerId;

    //客户名称
    private String customerName;

    //客户类型
    private String customerType;

    //联系人姓名
    private String contactName;

    //联系方式
    private String contactDetails;

    //客户邮箱
    private String customerEmail;

    //会员主合同
    private String masterMembershipContract;

    //会员主合同id
    private String masterMembershipContractId;

    //主合同起始时间
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date masterMembershipContractStartTime;

    //主合同结束时间
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date masterMembershipContractEndTime;

    //合同开始时间
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date contractStartDate;

    //合同结束时间
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date contractEndDate;

    //回款日期
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date payBackDate;

    //商机id
    private String opportunityId;

    //商机名称
    private String opportunityName;

    //跟进记录名称
    private String followRecordName;

    //跟进id
    private String followRecordId;

    //提前/延期原因
    private String advancePostponementReason;

    //合同总金额
    private BigDecimal contractTotalAmount;

    //合同优惠总金额
    private BigDecimal contractDiscountTotalAmount;

    //合同应收款
    private BigDecimal contractReceivables;

    //合同实际总金额
    private BigDecimal contractActualTotalAmount;

    //附件访问URl
    private String contractAnnexAccessUrl;

    //审核附件访问URL
    private String  reviewAnnexAccessUrl;

    //补充附件访问URL
    private String contractReplenishAnnexUrl;

    //订单编号
    private String orderNumber;

    //订单状态
    private String orderStatus;

    //付款方式
    private String paymentMethod;

    //附加费用
    private BigDecimal orderSurcharge;

    //附加费用备注
    private String orderSurchargeRemark;

    //合同审核备注
    private String contractReviewNotes;

    //创建人姓名
    private String createPeopleName;

    //创建时间
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTm;

    //合同审核状态
    private String contractReviewStatus;

    //审核是否加盖公章
    private String applyElectronicContract;

    private List<CustomerProductOrderDetail> productOrderDetailList;

    public String getContractTypeText(){
        String contractTypeText = "";
        if(!StringUtils.isBlank(contractType)){
            switch(contractType){
                case "1" :
                    contractTypeText = "非会员合同";
                    break;
                case "2" :
                    contractTypeText = "会员新单合同";
                    break;
                case "3" :
                    contractTypeText = "活动合同";
                    break;
                case "4" :
                    contractTypeText = "会员续费合同";
                    break;
                case "5" :
                    contractTypeText = "兑换合同";
                    break;
                case "6" :
                    contractTypeText = "单品合同";
                    break;
                case "7" :
                    contractTypeText = "会员单次";
                    break;
                default :
                    break;
            }
        }
        return contractTypeText;
    }

    public String getContractStatusText(){
        String contractStatusText = "";
        if(!StringUtils.isBlank(contractStatus)){
            switch(contractStatus){
                case "1" :
                    contractStatusText = "未生效";
                    break;
                case "2" :
                    contractStatusText = "生效中";
                    break;
                case "3" :
                    contractStatusText = "已结束";
                    break;
                case "4" :
                    contractStatusText = "已作废";
                    break;
                case "5" :
                    contractStatusText = "意外终止";
                    break;
                case "6" :
                    contractStatusText = "意外终止";
                    break;
                default :
                    break;
            }
        }
        return contractStatusText;
    }
}
